<template>
  <view class="">
    <remind-carinfo :dataBean="dataBean"></remind-carinfo>

    <view class="item" style="padding: 20rpx">
      <view style="display: inline-flex; height: 80rpx; justify-content: space-between">
        <u-icon name="order" color="#1573FF" label="出险信息" label-color="#333333"
                :customStyle="{ 'line-height': '80rpx' }"></u-icon>

        <!-- <text style="line-height: 80rpx; color: #E93131;">{{dataBean.carOutInsurance.repairStatusShow|filterNull}}</text> -->
      </view>

      <u-line color="#efefef" :customStyle="{ display: 'block' }"></u-line>

      <u-form class="item" style="padding: 0 20rpx 110rpx" :rules="rules" :model="carOutInsurance" ref="uform" label-width="auto">

        <u-form-item label="接收时间" @click="pickerShow(1)" borderBottom>
          <u-input v-model="carOutInsurance.receiveDate" inputAlign="right" disabled disabledColor="#ffffff"
                   border="none"
                   placeholder="请选择" type="select"></u-input>
          <u-icon slot="right" name="arrow-right"></u-icon>
        </u-form-item>

        <u-form-item label="报案人" borderBottom>
          <u-input v-model="carOutInsurance.reporter" border="none" inputAlign="right" placeholder="请输入"></u-input>
        </u-form-item>

        <u-form-item label="出险地点" borderBottom>
          <u-input v-model="carOutInsurance.outAddr" border="none" inputAlign="right" placeholder="请输入"></u-input>
        </u-form-item>

        <u-form-item label="出险时间" @click="pickerShow(2)" borderBottom>
          <u-input v-model="carOutInsurance.outDate" inputAlign="right" disabled disabledColor="#ffffff" border="none"
                   placeholder="请选择" type="select"></u-input>
          <u-icon slot="right" name="arrow-right"></u-icon>
        </u-form-item>

        <u-form-item label="出险经过及原因" borderBottom>
          <u-input v-model="carOutInsurance.outReason" border="none" inputAlign="right" placeholder="请输入"></u-input>
        </u-form-item>

        <u-form-item label="事故等级" @click="pickerShow(3)" borderBottom>
          <u-input v-model="carOutInsurance.outLevelShow" inputAlign="right" disabled disabledColor="#ffffff"
                   border="none"
                   placeholder="请选择" type="select"></u-input>
          <u-icon slot="right" name="arrow-right"></u-icon>
        </u-form-item>

        <u-form-item label="预估定损金额/元" borderBottom prop="predictLossFee">
          <u-input v-model="carOutInsurance.predictLossFee" type="digit" border="none" inputAlign="right"
                   placeholder="请输入"></u-input>
        </u-form-item>

        <u-form-item label="责任方" @click="pickerShow(10)" borderBottom>
          <u-input v-model="carOutInsurance.responsiblePartyShow" inputAlign="right" disabled disabledColor="#ffffff"
                   border="none"
                   placeholder="请选择" type="select"></u-input>
          <u-icon slot="right" name="arrow-right"></u-icon>
        </u-form-item>

        <u-form-item label="维修厂名称" borderBottom>
          <u-input v-model="carOutInsurance.serviceName" border="none" inputAlign="right"
                   placeholder="请输入"></u-input>
        </u-form-item>

        <u-form-item label="保险赔付情况" borderBottom @click="handleAdd(1)">
          <u-input v-model="carOutInsurance.insuranceCompanyName" border="none" inputAlign="right"
                   placeholder="请输入"/>
          <u-icon slot="right" name="arrow-right"/>
          <u-picker :show="showInsurance" :columns="insuranceList" @confirm="confirmInsurance"
                    @cancel="showInsurance = false"/>
        </u-form-item>

        <u-collapse v-if="carOutInsurance.insuranceCompensationList.length > 0">
          <u-collapse-item v-for="(item,index) in carOutInsurance.insuranceCompensationList" :title="item.payInsuranceName"
                           name="Numerous tools">
            <collapse-page v-model="carOutInsurance.insuranceCompensationList[index]"
            :payInsuranceList="payInsuranceList"
            :type="1" @delete="handleDele(index,item,1)"/>
          </u-collapse-item>
        </u-collapse>

        <u-form-item label="出险相关费用信息" borderBottom @click="handleAdd(2)">
          <u-input v-model="carOutInsurance.feeName" border="none" inputAlign="right"
                   placeholder="请输入"/>
          <u-icon slot="right" name="arrow-right"/>
          <u-picker :show="showExpense" :columns="expenseList" @confirm="confirmExpense"
                    @cancel="showExpense = false"/>
        </u-form-item>

        <u-collapse v-if="carOutInsurance.relatedCostsList.length > 0">
          <u-collapse-item v-for="(item,index) in carOutInsurance.relatedCostsList" :title="item.feeName"
                           name="Numerous tools">
            <collapse-page v-model="carOutInsurance.relatedCostsList[index]"
            :payeeList="payeeList"
            :type="2" @delete="handleDele(index,item,2)"/>
          </u-collapse-item>
        </u-collapse>


        <!--    000000000000000000    -->

        <u-form-item label="保险上浮费/元" borderBottom>
          <u-input v-model="carOutInsurance.floatFee" type="digit" border="none" inputAlign="right"
                   placeholder="请输入"></u-input>
        </u-form-item>

        <u-form-item label="维修返佣/元" borderBottom>
          <u-input v-model="carOutInsurance.repairBackFee" type="digit" border="none" inputAlign="right"
                   placeholder="请输入"></u-input>
        </u-form-item>

        <u-form-item label="商业险是否赔付" @click="pickerShow(4)" borderBottom>
          <u-input v-model="carOutInsurance.sxIsPayShow" inputAlign="right" disabled disabledColor="#ffffff"
                   border="none"
                   placeholder="请选择" type="select"></u-input>
          <u-icon slot="right" name="arrow-right"></u-icon>
        </u-form-item>

        <view v-show="carOutInsurance.sxIsPay == 1">
          <u-form-item label="商业险赔付保险公司" @click="pickerShow(5)" borderBottom>
            <u-input v-model="carOutInsurance.sxInsuranceCompanyName" inputAlign="right" disabled
                     disabledColor="#ffffff"
                     border="none" placeholder="请选择" type="select"></u-input>
            <u-icon slot="right" name="arrow-right"></u-icon>
          </u-form-item>

          <u-form-item label="商业险赔付金额/元" borderBottom>
            <u-input v-model="carOutInsurance.sxPayFee" border="none" inputAlign="right" placeholder="请输入"></u-input>
          </u-form-item>

          <u-form-item label="商业险赔付时间" @click="pickerShow(6)" borderBottom>
            <u-input v-model="carOutInsurance.sxPayDate" inputAlign="right" disabled disabledColor="#ffffff"
                     border="none"
                     placeholder="请选择" type="select"></u-input>
            <u-icon slot="right" name="arrow-right"></u-icon>
          </u-form-item>

          <u-form-item label="商业险客户赔付金额/元" borderBottom>
            <u-input v-model="carOutInsurance.sxCustomerPaymentAmount" border="none" inputAlign="right"
                     placeholder="请输入"></u-input>
          </u-form-item>
        </view>

        <u-form-item label="交强险是否赔付" @click="pickerShow(7)" borderBottom>
          <u-input v-model="carOutInsurance.qxIsPayShow" inputAlign="right" disabled disabledColor="#ffffff"
                   border="none"
                   placeholder="请选择" type="select"></u-input>
          <u-icon slot="right" name="arrow-right"></u-icon>
        </u-form-item>

        <view v-show="carOutInsurance.qxIsPay == 1">
          <u-form-item label="交强险赔付保险公司" @click="pickerShow(8)" borderBottom>
            <u-input v-model="carOutInsurance.qxInsuranceCompanyName" inputAlign="right" disabled
                     disabledColor="#ffffff"
                     border="none" placeholder="请选择" type="select"></u-input>
            <u-icon slot="right" name="arrow-right"></u-icon>
          </u-form-item>

          <u-form-item label="交强险赔付金额/元" borderBottom>
            <u-input v-model="carOutInsurance.qxPayFee" border="none" inputAlign="right" placeholder="请输入"></u-input>
          </u-form-item>

          <u-form-item label="交强险赔付时间" @click="pickerShow(9)" borderBottom>
            <u-input v-model="carOutInsurance.qxPayDate" inputAlign="right" disabled disabledColor="#ffffff"
                     border="none"
                     placeholder="请选择" type="select"></u-input>
            <u-icon slot="right" name="arrow-right"></u-icon>
          </u-form-item>

          <u-form-item label="交强险客户赔付金额/元" borderBottom>
            <u-input v-model="carOutInsurance.qxCustomerPaymentAmount" border="none" inputAlign="right"
                     placeholder="请输入"></u-input>
          </u-form-item>
        </view>

        <u-form-item label="备注" borderBottom>
          <u-input v-model="carOutInsurance.remark" border="none" inputAlign="right" placeholder="请输入备注"
                   type="textarea"></u-input>
        </u-form-item>

        <text style="padding: 20rpx 0; display: block; font-size: 30rpx; color: #333">
          出险附件
        </text>

        <lr-upload ref="upload1" @on-change="onListChange" :tag="1" :objType="19"></lr-upload>
      </u-form>
    </view>

    <examflow :from="pageType" :instanceId="instanceId" approvalName="carOutInsuranceApprove"
              :isAdd="'add' == pageType"></examflow>

    <!-- 接收时间 -->
    <u-datetime-picker :show="receiveDateTimeShow" mode="date" @confirm="timeconfirm"
                       @cancel="receiveDateTimeShow = false"></u-datetime-picker>

    <!-- <u-picker :mode="mode" v-model="receiveDateTimeShow" @confirm="pickerConfim()"></u-picker> -->
    <!-- 出险时间 -->
    <u-datetime-picker :show="outDateTimeShow" mode="date" @confirm="timeconfirm"
                       @cancel="outDateTimeShow = false"></u-datetime-picker>

    <!-- <u-picker :mode="mode" v-model="outDateTimeShow" @confirm="pickerConfim()"></u-picker> -->
    <!-- 商险赔付时间 -->
    <u-datetime-picker :show="sxPayDateShow" mode="date" @confirm="timeconfirm"
                       @cancel="sxPayDateShow = false"></u-datetime-picker>

    <!-- <u-picker :mode="mode" v-model="sxPayDateShow" @confirm="pickerConfim()"></u-picker> -->
    <!-- 强险赔付时间 -->
    <u-datetime-picker :show="qxPayDateShow" mode="date" @confirm="timeconfirm"
                       @cancel="qxPayDateShow = false"></u-datetime-picker>

    <!-- <u-picker :mode="mode" v-model="qxPayDateShow" @confirm="pickerConfim()"></u-picker> -->

    <!-- 事故等级 -->
    <u-picker :show="outLevelShow" :columns="accidentLevelList" keyName="value" @confirm="pickerConfim"
              @cancel="outLevelShow = false"></u-picker>

    <!-- <u-picker :mode="mode" v-model="outLevelShow" :default-selector="[0]" :range="accidentLevelList"
      range-key="value" @confirm="pickerConfim()"></u-picker> -->
    <!-- 责任方 -->
    <u-picker :show="responsiblePartyShow" :columns="responsibleParty" keyName="value" @confirm="pickerConfim"
              @cancel="responsiblePartyShow = false"></u-picker>

    <!-- <u-picker :mode="mode" v-model="responsiblePartyShow" :default-selector="[0]" :range="responsibleParty"
      range-key="value" @confirm="pickerConfim()"></u-picker> -->

    <!-- 商险是否赔付 -->
    <u-picker :show="sxIsPayShow" :columns="isPayList" keyName="value" @confirm="pickerConfim"
              @cancel="sxIsPayShow = false"></u-picker>

    <!-- <u-picker :mode="mode" v-model="sxIsPayShow" :default-selector="[0]" :range="isPayList" range-key="value"
      @confirm="pickerConfim()"></u-picker> -->
    <!-- 强险是否赔付 -->
    <u-picker :show="qxIsPayShow" :columns="isPayList" keyName="value" @confirm="pickerConfim"
              @cancel="qxIsPayShow = false"></u-picker>

    <!-- <u-picker :mode="mode" v-model="qxIsPayShow" :default-selector="[0]" :range="isPayList" range-key="value"
      @confirm="pickerConfim()"></u-picker> -->
    <!-- 商险赔付保险公司 -->
    <u-picker :show="sxCompanyShow" :columns="companyList" keyName="companyName" @confirm="pickerConfim"
              @cancel="sxCompanyShow = false"></u-picker>

    <!-- <u-picker :mode="mode" v-model="sxCompanyShow" :default-selector="[0]" :range="companyList"
      range-key="companyName" @confirm="pickerConfim()"></u-picker> -->
    <!-- 商险赔付保险公司 -->
    <u-picker :show="qxCompanyShow" :columns="companyList" keyName="companyName" @confirm="pickerConfim"
              @cancel="qxCompanyShow = false"></u-picker>

    <!-- <u-picker :mode="mode" v-model="qxCompanyShow" :default-selector="[0]" :range="companyList"
      range-key="companyName" @confirm="pickerConfim()"></u-picker> -->

    <u-modal ref="uModal" :show="showModal" :show-cancel-button="true" show-title="" @confirm="confirm"
             content="确定提交？"
             @cancel="showModal = false">
      <!-- #ifndef MP-WEIXIN || MP-TOUTIAO -->
      <!-- <view class="warp" style="margin: 30rpx;" v-if="contentSlot">
        <image class="logo" src="https://uviewui.com/common/logo.png" style="width: 220rpx;"
          mode="widthFix"></image>
      </view> -->
      <!-- #endif -->
    </u-modal>

    <view style="height: 100rpx"></view>

    <view class="button-container">
      <button class="btn-item" @click="commit">提 交</button>
    </view>
  </view>
</template>

<script>
import remindCarinfo from "../../../components/remind-carinfo.vue";
import lrUpload from "../../../components/global/lr-upload.vue";
import examflow from "@/components/exam-flow.vue";
import {isVideo} from "@/common/calc";
import collapsePage from './collapsePage.vue'

export default {
  components: {
    remindCarinfo,
    lrUpload,
    examflow,
    collapsePage
  },
  computed: {
    handleLabel() {
      return function (val, list) {
        let obj = list[0].find((a) => a.value == val);
        return obj?.text || "";
      };
    },
  },
  data() {
    return {
      dataBean: {
        vehicle: {},
        carOutInsurance: {},
      },
      responsibleParty: [
        [
          {
            value: "0%",
            code: 5,
          },
          {
            value: "20%",
            code: 1,
          },
          {
            value: "30%",
            code: 2,
          },
          {
            value: "50%",
            code: 3,
          },
          {
            value: "70%",
            code: 6,
          },
          {
            value: "100%",
            code: 4,
          },
        ],
      ],
      isPayList: [
        [
          {
            value: "是",
            code: 1,
          },
          {
            value: "否",
            code: 2,
          },
        ],
      ],
      carOutInsurance: {
        carId: "",
        receiveDate: "",
        outDate: "",
        outAddr: "",
        reporter: "",
        outReason: "",
        insuranceCompany: "",
        insuranceCompanyShow: "",
        outLevel: "",
        outLevelShow: "",
        responsibleParty: "",
        remark: "",
        sxIsPayShow: "",
        qxIsPayShow: "",
        responsiblePartyShow: "",
        attachment: [],
        sxIsPay: null,
        sxInsuranceCompanyId: "",
        sxInsuranceCompanyName: "",
        serviceName: "",
        predictLossFee: "",
        floatFee: "",
        repairBackFee: "",
        sxPayFee: "",
        sxCustomerPaymentAmount: "",
        sxPayDate: "",

        qxIsPay: null,
        qxInsuranceCompanyId: "",
        qxInsuranceCompanyName: "",
        qxCustomerPaymentAmount: "",
        qxPayDate: "",
        qxPayFee: "",
        insuranceType: '',
        insuranceCompensationList:[],
        relatedCostsList:[],
      },
      rules:{
        predictLossFee:[
        {
            validator: (rule, value, callback) => {
              return   /^(?:[1-9]\d*|0)(?:\.\d{0,2})?$/.test(value);
            },
            message: '请输入整数或者保留两位小数',
            trigger: ['change', 'blur'],
          }
        ]
      },

      mode: "",
      type: 0,
      receiveDateTimeShow: false,
      outDateTimeShow: false,
      outLevelShow: false,
      sxIsPayShow: false,
      sxCompanyShow: false,
      sxPayDateShow: false,
      qxIsPayShow: false,
      qxCompanyShow: false,
      qxPayDateShow: false,
      responsiblePartyShow: false,
      showModal: false,
      pageType: "",
      instanceId: "",
      businessId: "",

      companyList: [],
      accidentLevelList: [],
      restart: "",
      showInsurance: false,
      insuranceList: [
        [
          {text: "交强险", value: "1",},
          {text: "承运险", value: "2",},
          {text: "商业险", value: "3",},
        ],
      ],
      tableData: [],
			showExpense:false,
			expenseList:[
				[
          {text: "保险上浮费", value: "1",},
          {text: "维修费", value: "2",},
          {text: "折旧费", value: "3",},
          {text: "其他费用", value: "4",},
				]
			],
			tableList:[],
      payeeList: [],
      payInsuranceList:[]
    };
  },
  onLoad(options) {
    let that = this;
    this.accidentLevelList = [
      this.$store.state.params.getCarCommon.accidentLevel,
    ];
    this.companyList = [this.$store.state.params.insuranceCompanyList];
    var data = getApp().globalData.outdanger_bean;
    this.dataBean.vehicle = data;
    this.carOutInsurance.carId = options.carId;
    this.pageType = options.pageType;
    this.instanceId = options.instanceId;
    this.businessId = options.businessId;
    this.restart = options.restart;

    getApp().globalData.outdanger_bean = {};

    if ("add" == this.pageType) {
      uni.setNavigationBarTitle({
        title: "新增车辆出险",
      });
    } else {
      uni.setNavigationBarTitle({
        title: "编辑车辆出险",
      });
    }

    let userInfo = uni.getStorageSync("saveUserInfo");

    if (!uni.$u.test.isEmpty(this.businessId)) {
      //获取编辑回显信息
      this.$u.api
          .outinsuranceDetail({
            carId: this.carOutInsurance.carId,
            businessId: this.businessId,
          })
          .then((res) => {
            if (1 == this.restart) {
              //重新发起的id要置为空
              res.carOutInsurance.id = null;
            }
            this.dataBean = res;
            this.carOutInsurance = res.carOutInsurance;

            this.carOutInsurance.sxIsPay =
                "是" == res.carOutInsurance.sxIsPayShow ? "1" : "2";
            this.carOutInsurance.qxIsPay =
                "是" == res.carOutInsurance.qxIsPayShow ? "1" : "2";

            // this.carOutInsurance.serviceName = this.$store.state.user.userInfo.officialPartner

            if (!uni.$u.test.isEmpty(this.carOutInsurance.attachment)) {
              this.$refs.upload1.fileList1 = this.carOutInsurance.attachment
                  .filter((item) => {
                    return 1 == item.type_file || 1 == item.typeFile;
                  })
                  .map((item) => {
                    return {
                      ...item,
                      message: "",
                      size: 52363,
                      status: "success",
                      thumb: that.baseImgUrl() + item.url,
                      type: isVideo(item.url),
                      url: item.url,
                    };
                  });
            }
          });
    }

    this.carOutInsurance.serviceName = this.$store.state.user.userInfo.officialPartner;
  },
  mounted() {
    this.handleList()
  },
  methods: {
    handleList() {
      this.$u.api.getPayeeList({carId: this.dataBean.vehicle.carId}).then(res => {
        this.payeeList = res || []
      })
      this.$u.api.getPayInsuranceList({}).then(res => {
        this.payInsuranceList = res || []
      })
    },

    handleAdd(type) {
      if(type === 1){
        if(this.insuranceList[0].length > 0){
          this.showInsurance = true;
        }else{
          this.$u.toast("暂无");
        }
      }
      if(type === 2){
        if(this.expenseList[0].length > 0){
          this.showExpense = true;
        }else{
          this.$u.toast("暂无");
        }
      }
    },

    confirmInsurance(e) {

      const { value,text} = e.value[0];
			this.carOutInsurance.insuranceType = value;
			this.carOutInsurance.insuranceCompanyName = text;
      const obj = {
        payInsuranceName: text,
        insuranceCompanyId: '',
        insuranceCompanyName:'' ,
        payFee: '',
        payDate: '',
        remark: '',
      };

      this.carOutInsurance.insuranceCompensationList.push(obj);

      const index = this.insuranceList[0].findIndex((item) => item.value === value);

      if (index !== -1) {
        this.insuranceList[0].splice(index, 1);
      }

      this.showInsurance = false;
    },

    confirmExpense(e){
      const { value,text} = e.value[0];
      this.carOutInsurance.expenseType = value;
      this.carOutInsurance.feeName = text;
      const obj = {
        feeName: text,
        expenseType:value,
        payableAmount: null,
        paymentObjName: '',
        isGeneratePayableBill: 0,
        receivableAmount: null,
        receivableObjNo: '',
        receivableObjName: '',
        isGenerateReceivableBill: 0,
      };

      this.carOutInsurance.relatedCostsList.push(obj);

      const index = this.expenseList[0].findIndex((item) => item.value === value);

      if (index !== -1) {
        this.expenseList[0].splice(index, 1);
      }

      this.showExpense = false;
    },

    handleDele(index,row,type) {
      if(type === 1){
        this.carOutInsurance.insuranceCompensationList.splice(index, 1)
        let obj = {
          value:row.payInsuranceName,
          text:row.insuranceCompanyName
        }
        this.insuranceList[0].push(obj)
      }

      if(type === 2){
        this.carOutInsurance.relatedCostsList.splice(index, 1)
        let obj = {
          value:row.expenseType,
          text:row.feeName
        }
        this.expenseList[0].push(obj)
      }

    },

    pickerShow(type) {
      this.type = type;
      switch (type) {
        case 1:
          this.receiveDateTimeShow = true;
          this.mode = "time";
          break;
        case 2:
          this.outDateTimeShow = true;
          this.mode = "time";
          break;
        case 3:
          this.outLevelShow = true;
          this.mode = "selector";
          break;
        case 4:
          this.sxIsPayShow = true;
          this.mode = "selector";
          break;
        case 5:
          this.sxCompanyShow = true;
          this.mode = "selector";
          break;
        case 6:
          this.sxPayDateShow = true;
          this.mode = "time";
          break;
        case 7:
          this.qxIsPayShow = true;
          this.mode = "selector";
          break;
        case 8:
          this.qxCompanyShow = true;
          this.mode = "selector";
          break;
        case 9:
          this.qxPayDateShow = true;
          this.mode = "time";
          break;
        case 10:
          this.responsiblePartyShow = true;
          this.mode = "selector";
          break;
      }
    },

    timeconfirm(e) {
      let timeStr = uni.$u.timeFormat(e.value, "yyyy-mm-dd");

      switch (this.type) {
        case 1:
          this.receiveDateTimeShow = false;
          this.carOutInsurance.receiveDate = timeStr;
          break;
        case 2:
          this.outDateTimeShow = false;
          this.carOutInsurance.outDate = timeStr;
          break;
        case 6:
          this.sxPayDateShow = false;
          this.carOutInsurance.sxPayDate = timeStr;
          break;
        case 9:
          this.qxPayDateShow = false;
          this.carOutInsurance.qxPayDate = timeStr;
          break;
      }
    },

    pickerConfim(e) {
      switch (this.type) {
        case 3:
          this.outLevelShow = false;
          // let obj1 = this.accidentLevelList[e];
          let obj1 = e.value[0];
          this.carOutInsurance.outLevelShow = obj1.value;
          this.carOutInsurance.outLevel = obj1.code;
          break;
        case 4:
          this.sxIsPayShow = false;
          // let obj2 = this.isPayList[e];
          let obj2 = e.value[0];
          this.carOutInsurance.sxIsPayShow = obj2.value;
          this.carOutInsurance.sxIsPay = obj2.code;
          break;
        case 5:
          this.sxCompanyShow = false;
          // let obj3 = this.companyList[e];
          let obj3 = e.value[0];
          this.carOutInsurance.sxInsuranceCompanyName = obj3.companyName;
          this.carOutInsurance.sxInsuranceCompanyId = obj3.companyId;
          break;
        case 7:
          this.qxIsPayShow = false;
          // let obj4 = this.isPayList[e];
          let obj4 = e.value[0];
          this.carOutInsurance.qxIsPayShow = obj4.value;
          this.carOutInsurance.qxIsPay = obj4.code;
          break;
        case 8:
          this.qxCompanyShow = false;
          // let obj5 = this.companyList[e];
          let obj5 = e.value[0];
          this.carOutInsurance.qxInsuranceCompanyName = obj5.companyName;
          this.carOutInsurance.qxInsuranceCompanyId = obj5.companyId;
          break;
        case 10:
          this.responsiblePartyShow = false;
          // let obj6 = this.responsibleParty[e];
          let obj6 = e.value[0];
          this.carOutInsurance.responsiblePartyShow = obj6.value;
          this.carOutInsurance.responsibleParty = obj6.code;
          break;
      }
      // }
    },

    onListChange(tag, list, objList) {
      if (tag == 1) {
        this.carOutInsurance.attachment = objList;
      }
    },

    commit() {
      // this.showModal = true;
      let that = this;
      uni.showModal({
        content: "确定提交吗?",
        success(res) {
          if (res.confirm) {
            that.dataBean.carOutInsurance = that.carOutInsurance;
            that.$u.api.saveOutinsurance(that.dataBean).then((res) => {
              that.$u.toast("提交成功");
              setTimeout(() => {
                uni.navigateBack();
              }, 1000);
            });
          }
        },
      });
    },

    confirm() {
      this.dataBean.carOutInsurance = this.carOutInsurance;
      this.$u.api.saveOutinsurance(this.dataBean).then((res) => {
        this.$u.toast("提交成功");
        setTimeout(() => {
          uni.navigateBack();
        }, 1000);
      });
    },
  },
};
</script>

<style lang="scss">
page {
  height: 100%;
}

.bottom {
  position: fixed;
  width: 100%;
  height: 100rpx;
  bottom: 0;
  z-index: 999;
  background-color: white;
  display: flex;
  align-items: center;
  justify-content: center;

  text {
    width: 98%;
    height: 80rpx;
    line-height: 80rpx;
    border-radius: 50rpx;
    background-color: $blue15;
    color: white;
    text-align: center;
    font-size: 30rpx;
  }
}
</style>
